<?php

namespace App\Providers;

use App\Entities\ClassEntity;
use App\Entities\ClassMember;
use App\Entities\Course;
use App\Repositories\Eloquent\EloquentClassMemberRepository;
use App\Repositories\Eloquent\EloquentClassRepository;
use Illuminate\Support\ServiceProvider;
use App\Repositories\Eloquent\EloquentTermRepository;
use App\Repositories\Eloquent\EloquentCourseRepository;
use App\Repositories\Eloquent\EloquentMemberRepository;

use App\Entities\Term;
use App\Entities\Member;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //

    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
        $this->registerBindings();
    }

    private function registerBindings()
    {
        $this->app->bind(
            'App\Repositories\TermRepository',
            function() {
                return new EloquentTermRepository(new Term());
            }
        );
        $this->app->bind(
            'App\Repositories\CourseRepository',
            function() {
                return new EloquentCourseRepository(new Course());
            }
        );
        $this->app->bind(
            'App\Repositories\ClassRepository',
            function() {
                return new EloquentClassRepository(new ClassEntity());
            }
        );
        $this->app->bind(
            'App\Repositories\MemberRepository',
            function() {
                return new EloquentMemberRepository(new Member());
            }
        );
        $this->app->bind(
            'App\Repositories\ClassMemberRepository',
            function() {
                return new EloquentClassMemberRepository(new ClassMember());
            }
        );
    }
}
